// 导入封装的JS文件
import Network from './network'
let baseUrl = {
  basic: 'http://localhost:8081',
  outurl: '/api'
}
// 获取外部api接口
// 新闻头条
export const getNews = (type, page = 1) => Network.get(baseUrl.outurl + '/toutiao/index?key=ccff5e871144f75a0b6a67616aad8f23&type=' + type + '&page=' + page)

// 登录
export const login = (loginInfo) => Network.post(baseUrl.basic + '/user/getUsersByUsernameAndPassword', loginInfo)
// 注册
export const register = (registerInfo) => Network.post(baseUrl.basic + '/user/register', registerInfo)
// 信息修改
export const updateUser = (userInfo) => Network.post(baseUrl.basic + '/user/updateUser', userInfo)
// 投诉
export const submitSuggestion = (suggest) => Network.post(baseUrl.basic + '/suggest/insertSuggest', suggest)

// 获取新闻
export const findAllNews = () => Network.get(baseUrl.basic + '/news/getAllNews')
// 通过id获取新闻
export const findNewsById = (id) => Network.get(baseUrl.basic + '/news/getNewsById?id=' + id)

// 获取当前待缴费订单
export const getPayList = (userId) => Network.get(baseUrl.basic + '/pay/getPayListByUserId?userId=' + userId)
// 缴费
export const submitPay = (orderList) => Network.post(baseUrl.basic + '/pay/submitOrder', orderList)

// 获取家政清洁列表清单
export const getCleanList = () => Network.get(baseUrl.basic + '/clean/getCleanList')
// 提交订单
export const submitOrder = (order) => Network.post(baseUrl.basic + '/order/insertOrder', order)
// 获取维修清单列表
export const getCommonlyFixList = () => Network.get(baseUrl.basic + '/fix/findCommonlyFixList?type=0')

// 获取师傅列表
export const getMaster = (type) => Network.get(baseUrl.basic + '/master/getMasterByType?type=' + type)

// 获取全部住房信息
export const getBuildingList = () => Network.get(baseUrl.basic + "/building/getBuildingList")
// 根据ownerId获取住房信息
export const getBuildingByOwnerId = (ownerId) => Network.get(baseUrl.basic + "/building/getBuildingByOwnerId?ownerId=" + ownerId)

// 获取订单列表
export const getOrderListById = (id) => Network.get(baseUrl.basic + '/order/getOrderById/' + id)
// 修改订单状态
export const changeStatus = (obj) => Network.post(baseUrl.basic + '/order/changeStatus', obj)
// 取消订单
export const cancelOrder = (id) => Network.get(baseUrl.basic + '/order/cancelOrder/' + id);
